{-# LANGUAGE EmptyDataDecls #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}

module Generics.MultiRec.Languages.Python where

import Generics.MultiRec
import Generics.MultiRec.TH.Alt

import Language.Python.Common.AST
import Language.Python.Common.SrcLocation

data PYTHON :: (* -> *) where
  TheIdentSpan :: PYTHON (IdentSpan)
  TheModuleSpan :: PYTHON (ModuleSpan)
  TheSuiteSpan :: PYTHON (SuiteSpan)
  TheDottedNameSpan :: PYTHON (DottedNameSpan)
  TheImportItemSpan :: PYTHON (ImportItemSpan)
  TheFromItemSpan :: PYTHON (FromItemSpan)
  TheFromItemsSpan :: PYTHON (FromItemsSpan)
  TheImportRelativeSpan :: PYTHON (ImportRelativeSpan)
  TheStatementSpan :: PYTHON (StatementSpan)
  TheRaiseExprSpan :: PYTHON (RaiseExprSpan)
  TheDecoratorSpan :: PYTHON (DecoratorSpan)
  TheParameterSpan :: PYTHON (ParameterSpan)
  TheParamTupleSpan :: PYTHON (ParamTupleSpan)
  TheArgumentSpan :: PYTHON (ArgumentSpan)
  TheHandlerSpan :: PYTHON (HandlerSpan)
  TheExceptClauseSpan :: PYTHON (ExceptClauseSpan)
  TheCompForSpan :: PYTHON (CompForSpan)
  TheCompIfSpan :: PYTHON (CompIfSpan)
  TheCompIterSpan :: PYTHON (CompIterSpan)
  TheExprSpan :: PYTHON (ExprSpan)
  TheSliceSpan :: PYTHON (SliceSpan)
  TheOpSpan :: PYTHON (OpSpan)
  TheSrcSpan :: PYTHON (SrcSpan)
  TheAssignOpSpan :: PYTHON (AssignOpSpan)
  TheExprSpanMaybe :: PYTHON (Maybe ExprSpan)
  TheExprSpanList :: PYTHON ([] ExprSpan)
  TheImportItemSpanList :: PYTHON ( [] (ImportItem SrcSpan))
  TheParameterSpanList :: PYTHON ( [] (Parameter SrcSpan))
  TheArgumentSpanList :: PYTHON ( [] (Argument SrcSpan))
--  TheSpecial1 :: PYTHON ( [] ((,) (Expr SrcSpan) (Suite SrcSpan)))
--  TheDecoratorSpanList :: PYTHON ( [] (Decorator SrcSpan))
  TheHandlerSpanList :: PYTHON ( [] (Handler SrcSpan))
  TheBool :: PYTHON ( Bool )



$(deriveEverything
  (DerivOptions 
   [ ( [t| IdentSpan |] ,"TheIdentSpan")
   , ( [t| ModuleSpan |] ,"TheModuleSpan")
   , ( [t| SuiteSpan |] ,"TheSuiteSpan")
   , ( [t| DottedNameSpan |] ,"TheDottedNameSpan")
   , ( [t| ImportItemSpan |] ,"TheImportItemSpan")
   , ( [t| FromItemSpan |] ,"TheFromItemSpan")
   , ( [t| FromItemsSpan |] ,"TheFromItemsSpan")
   , ( [t| ImportRelativeSpan |] ,"TheImportRelativeSpan")
   , ( [t| StatementSpan |] ,"TheStatementSpan")
   , ( [t| RaiseExprSpan |] ,"TheRaiseExprSpan")
   , ( [t| DecoratorSpan |] ,"TheDecoratorSpan")
   , ( [t| ParameterSpan |] ,"TheParameterSpan")
   , ( [t| ParamTupleSpan |] ,"TheParamTupleSpan")
   , ( [t| ArgumentSpan |] ,"TheArgumentSpan")
   , ( [t| HandlerSpan |] ,"TheHandlerSpan")
   , ( [t| ExceptClauseSpan |] ,"TheExceptClauseSpan")
   , ( [t| CompForSpan |] ,"TheCompForSpan")
   , ( [t| CompIfSpan |] ,"TheCompIfSpan")
   , ( [t| CompIterSpan |] ,"TheCompIterSpan")
   , ( [t| ExprSpan |] ,"TheExprSpan")
   , ( [t| SliceSpan |] ,"TheSliceSpan")
   , ( [t| OpSpan |] ,"TheOpSpan")
   , ( [t| SrcSpan |] ,"TheSrcSpan")
   , ( [t| AssignOpSpan |] ,"TheAssignOpSpan")
   , ( [t| Maybe ExprSpan |] ,"TheExprSpanMaybe")
   , ( [t| [] ExprSpan |] ,"TheExprSpanList")
   , ( [t| [] (ImportItem SrcSpan) |],"TheImportItemSpanList")
   , ( [t| [] (Parameter SrcSpan) |],"TheParameterSpanList")
   , ( [t| [] (Argument SrcSpan) |],"TheArgumentSpanList")
--   , ( [t| [] ((,) (Expr SrcSpan) (Suite SrcSpan)) |],"TheSpecial1")
--   , ( [t| [] (Decorator SrcSpan) |],"TheDecoratorSpanList")
   , ( [t| [] (Handler SrcSpan) |],"TheHandlerSpanList")
   , ( [t|  (Bool) |],"TheBool")
   ]
   "PYTHON"
   (\t c -> "CONSTRUCTOR_" ++ t ++ "_" ++ c)
   "PYTHONPF"
   True
   Balanced
  )
 )

type instance PF PYTHON = PYTHONPF
